package IO流.字节流.FileOutputStream.Test01;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class FileOutputStreamTest01 {
    public static void main(String[] args) {
        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream("javase/src/IO流/myFile",true);
            byte[] bytes = {107,105,108,108,101,114,32,113,117,101,101,110,33};
            fos.write(bytes);
            //fos.write(bytes,3,2);
            String s = "\n我不做人了，jojo!!!!";
            byte[] jojo = s.getBytes();
            fos.write(jojo);
            fos.flush();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally{
            if (fos != null){
                try {
                    fos.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
